import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  { path: '/login', name: 'Login', component: () => import('../views/Login') },
  {
    path: '/404',
    component: () => import('@/views/404')
  },
  {
    path: '/',
    name: '/',
    redirect: '/welcome',
    component: () => import('../views/home/Home'),
    children: [
      { path: '/welcome', name: 'welcome', meta: { name: 0, truePath: '/welcome' }, component: () => import('../views/home/Welcome') } // 首页组件
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
